Skip to content

Conversation

@ehelms
Copy link
Member

@ehelms ehelms commented Dec 20, 2024

This will allow us to disable the bootstrap RPM and the consumer RPM when we are ready. The only odd situation is if someone were to re-enable it the RPM counter would start back at 1 which clients with the RPM already would not upgrade to without being forced.

copy_sources
write_specfile
build_rpm
if resource[:ensure] == :absent
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This feels like an abuse of exists. I suppose it already was and I think this currently doesn't support noop mode, but this really is making it much worse. exists? should really answer the question if anything exists.

Looking at the source, I think this is the relevant bit:
https://github.com/puppetlabs/puppet/blob/e227c27540975c25aa22d533a52424a9d2fc886a/lib/puppet/property/ensure.rb#L68-L95

So if anything, it should be changed to:

if resource[:ensure] == :absent
  File.exist?(resource[:symlink]) || !all_rpms.empty? || !all_rpms(source: true).empty?
else
  !File.exist?(resource[:symlink]) || all_rpms.empty? || all_rpms(source: true).empty? || rpm_changed?
end

Then it will end up calling .create:
https://github.com/puppetlabs/puppet/blob/e227c27540975c25aa22d533a52424a9d2fc886a/lib/puppet/property/ensure.rb#L16-L23
Or .destroy:
https://github.com/puppetlabs/puppet/blob/e227c27540975c25aa22d533a52424a9d2fc886a/lib/puppet/property/ensure.rb#L25-L32

It's still not very nice, but since it's going away I think that's ok.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This doesn't work as you have to have this part:

    copy_sources
    write_specfile
    build_rpm

Which creates the temporary RPM to detect if the RPM has changed. Even if I include that in the else, all the tests break. That has been where this whole resource is tricky.

The RPM only needs to change if the input script, katello-rhsm-consumer, changes. To detect if the RPM exists with that script has mean that we need to temporarily generate the RPM, and then compare the generated RPM to the current latest one and see if it's changed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants